const { GameServer } = require('board-game');
const { server } = require('./config');

const VsCardGame = require('./game');
const VsCardRole = require('./role');
const VsCardBoard = require('./board');

GameServer.start({
    doPlayCard: ({role, data}) => role.doPlayCard(data),
    doPass: ({ role }) => role.doPass(),
    doChoose: ({ role, data }) => role.doChoose(data.type),
    doReplace: ({ role, data }) => role.doReplace(data),
    doCancelReplace: ({ role }) => role.doCancelReplace(),
}, {
    Game: VsCardGame,
    Board: VsCardBoard,
    Role: VsCardRole,
}, server, {
    index: './web/index.js',
    compress: process.env.NODE_ENV !== 'development',
    watch: process.env.NODE_ENV === 'development',
    stats: 'verbose',
    devtools: process.env.NODE_ENV === 'development'
});